package net.midnighttd.engine.entity.Pathfinder;

import java.util.LinkedList;

/**
 * Author: Adam Scarr
 * Date: 24/04/2009
 * Time: 6:25:18 PM
 */
public class TaskQueue {
    private LinkedList<PathfinderTask> queue = new LinkedList<PathfinderTask>();

    public synchronized PathfinderTask contains(PathfinderTask element) {
        for(PathfinderTask e: queue) {
            if(e.equals(element)) {
                return e;
            }
        }
        return null;
    }

    public synchronized PathfinderTask poll() {
        return queue.poll();
    }

    public synchronized void add(PathfinderTask t) {
        queue.add(t);
    }
}
